<template>
	<!-- 绑定样式属性时,遵循vue的语法 -->
	<view>
		<view class="home-header" :style="'height:'+navH+'rpx;'">
			<view class="header">
				<!-- 扫一扫 -->
				<text class="iconfont icon-saoyisao"></text>
				<!-- 相机 -->
				<text class="iconfont icon-xiangji"></text>
				<!-- 搜索 -->
				<view class="search" @click="toSearch">
					<text class="iconfont icon-sousuo"></text>
				</view>
				<view>首页</view>
			</view>
		</view>
		<div class="zhanwei" :style="'height:'+navH+'rpx;'"></div>
	</view>
</template>

<script>
	const app = getApp()
	console.log(app.globalData)
	export default {
		name: "home-header",
		data() {
			return {
				navH: app.globalData.navBarHeight
			};
		},
		methods:{
			toSearch(){
				console.log('点击');
				uni.navigateTo({
					url:'/pages/search/search'
				})
			}
		}
	}
</script>

<style>
	.home-header {
		width: 100%;
		/* iphone6,7,8 44px+88px */
		height: 128rpx;
		position: fixed;
		top: 0;
		left: 0;
		background-color: #f44;
		z-index: 100;
	}
.zhanwei{
	width: 100%;
	height: 100%;
}
	.home-header .header {
		width: 100%;
		height: 88rpx;
		display: flex;
		align-items: center;
		color: #fff;
		position: absolute;
		bottom: 0;
		left: 0;
	}

	.home-header .header .iconfont {
		margin-left: 15rpx;
	}

	.home-header .search {
		width: 200rpx;
		height: 60rpx;
		background-color: #fff;
		border-radius: 40rpx;
		color: #999;
		line-height: 60rpx;
		padding-left: 10rpx;
		margin: 0 20rpx;
	}
</style>
